Service Manager
Expression Grammar
•About Using Values in Expressions
•Using Relationship Specifiers
About Expressions
An expression is a description of how to compute a value. It can call a function, be a reference to a field, or be a literal. Expressions can also be composed of one or more of these with operators in between them.
Expressions are used in many places throughout Service Manager, including in business rules, saved searches, quick action definitions, list filters, visibility rules on form controls, and more.
Most expressions simply compute a value. However, a few of the built-in functions do more than just compute a value. They affect the application in ways other than returning a value. For example, the Prompt function prompts the user for an input, and the GetNext Counter function returns the value of the counter but also increments the counter.
About SubExpressions
A subexpression is an expression within an expression that computes a value, but has a different context and may also be evaluated more than once. Currently, subexpressions can only be passed as arguments to certain built-in functions. The ChildFold, FindAncestor, ForEachChild, IfAllSiblings, IsTrueForAllChildren, Prompt, and PromptAndExecuteAction are the only built-in functions that use subexpressions.
An example of a subexpression is:
$(FindAncestor("Frs_CompositeContract_Entity", "ServiceAgreement", EntityLink_RecID,
"$((ServiceLink == [OtherObject]Service_Valid) && (Status == \"Published\"))"
))
The sub expression starts with "$((ServiceLink.
There are two ways to call a subexpression: the "old" way, which is to enter the entire subexpression as a string within double quotes, or the "new" way, which is to enter it without double quotes. (If you use the new way, you do not need to use the backslash to escape the quotes within the string.)
In this example, the function looks for an ancestor and for each one it finds, it evaluates the subexpression and each time it evaluates it, it has a different subcontext. The field references in the subexpression do not refer to the same object as the field references outside of the subexpression.
Basic Expression Grammar
At the outer level, enclose an expression, function, or field reference with a dollar sign with parentheses, as follows:
$( )
The $( can only appear as the outer most portion of the expression, and should not appear anywhere within the expression itself, except as a subexpression. If you enter $( anywhere else within the expression, the parser cannot interpret the expression properly, and incorrectly interprets the entire expression as if it were a regular text literal.
In certain cases, the parser does allow for expressing simple values, without requiring the use of $(). An example is expressing simple text literal values such as "Active".
At this time, Service Manager does not allow you to add comments to expressions.
At the highest level, you enter either an expression or a standalone literal.
Calling Built-In Functions
To call a built-in function, use this syntax:
$(FunctionName (arguments))
where arguments can be zero or more arguments to the function, separated by commas. The arguments can be expressions that compute values, field references, or literals.
See Working with Built-in Functions for complete information about all of the Service Manager built-in functions.
About Using Values in Expressions
The values in expressions are represented as either floating point numbers or integers. Service Manager supports 32-bit and 64-bit integers.
However, all numbers in JavaScript are represented as double precision floating point numbers. Therefore, when expressions are executed on the client, we do not support integers at all, including 64-bit integers. Because double-precision floating point integers can only represent integers exactly between 2-53 and 253 -1, the application rounds any calculations of integers that are larger or smaller than that, but less than 2-64 through 264 -1.
Was this article useful?
Copyright © 2019, Ivanti. All rights reserved.